<block name="content">
    <form class="layui-form inline-form">
    <div class="pull-left">

        <div class="layui-inline">
            <button class="layui-btn layui-btn-warm ajax-form"
                    data-url="{:url('finadd?project_id='.$project_id)}"
            ><i class="layui-icon">&#xe61f;</i> 新增财务数据
            </button>
        </div>

    </div>
    </form>
    <table class="layui-table text-center" id="list" lay-filter="list"
           list-url="{:url('project/financial/finlists?project_id='.$project_id)}"
           edit-url="{:url('finadd?project_id='.$project_id)}"
           del-url="{:url('delete?project_id='.$project_id)}"
         ></table>

</block>
<block name="script">
    <script charset="utf-8" src="https://cdn.weibuyun.com/static/admin/plugins/wangeditor/wangEditor.min.js"></script>
    <script charset="utf-8" src="https://unpkg.com/qiniu-js@2.5.4/dist/qiniu.min.js"></script>
    <script type="text/html" id="barDemo">
        <a class="layui-btn  layui-btn-xs " lay-event="edit"><i class="fa fa-pencil"></i> 编辑</a>
        <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="delete"> <i class="fa fa-trash-o"></i> 删除</a>
    </script>

    <script type="text/javascript">
        layui.use(['element', 'table', 'form', 'tree'], function () {
            var table = layui.table
                , element = layui.element
                , form = layui.form;
            table.render({
                elem: '#list'
                , url: "{:Url('project/financial/finlists?project_id='.$project_id)}"
                , page: true
                ,limit:20
                , cols: [[
                    {field: 'c_time', width: 180, title: '操作时间'}
                    , {field: 'nickname', width: 90, title: '操作人员'}
                    , {field: 'financial_type', width: 90, title: '财务类型'}
                    , {field: 'project_financial', width: 100, title: '财务分类'}
                    , {field: 'price', width: 120,title: '金额',align:'right'}
                    , {field: 'remind_time', width: 180,title: '提醒时间'}
                    , {field: 'info',  title: '备注'}
                    , {fixed: 'right', width: 130, title: '操作', toolbar: '#barDemo'}
                ]]
            });

            form.on('submit(logsearch_btn)', function (data) {
                table.reload('list', {
                    url: "{:Url('project/financial/finlists?project_id='.$project_id)}"
                    , page: {
                        curr: 1
                    }
                    , where: data.field
                });
                return false;
            });
            form.on('select(log_type)', function (data) {
                table.reload('list', {
                    url: "{:Url('project/financial/finlists?project_id='.$project_id)}"
                    , page: {
                        curr: 1
                    }
                    , where: {
                        status: data.value
                    }
                });
                return false;
            });

        });
    </script>
</block>
